<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>           
<script>   //截取的字符串包含  start   
//不包含end位置的字符     str.slice(start,end)
    var str ="nice to meet you";
    var childStr = str.slice(0,3);
    console.log(childStr);
    //空格也算一个字符
    var str2 = str.slice(1);
    console.log(str2);  //ice to meet you        截取结果是从截取起始到整个字符串结束
    var str3 =str.slice(-3);
    console.log(str3);     //设定的负值，表示从友向左，确定索引位置

    </script>
</html>